.. _Metrics Discrete Dynamic:

Metrics for the Discrete Dynamic model with GUI
====================================================

The **Metrics** tab calculates a set of metrics on the provided dataset. 

Metrics, provided for **Discrete Dynamic** are: 

.. math:: \frac{ \|prediction\_ normalized - reference\_ normalized\|_{fro}}{\|reference\_ normalized\|_{fro}}

.. math:: \frac{ \|prediction - reference\|_{fro}}{\|reference\|_{fro}}

.. math:: \frac{ \|prediction - reference\|_{fro}}{\|(reference - mean(reference))\|_{fro}}

.. math:: \frac{max(|prediction - reference|)}{max(|reference|)}

.. math:: \frac{max(|prediction - reference|)}{max(|reference|) - min(|reference|)}


* Switch to the **Metrics** tab

* To calculate metrics, click on the dataset in the **Evaluation files** section. Use **Aditional +** to add the datasets. For metrics calculation both **input file** and **output file** containing the data at the same timepoints have to be provided (see :std:ref:`Data preparation for NeurEco Discrete Dynamic GUI`).

* Choose the initialization option:

  * Click **Default Initialization** for metrics with the prediction evaluated using the default initialization: the number of time steps used for initialization is equal to the number deduced during the **Build** of the model (**init time steps** provided in the checkpoint slider).
    The **Default Initialization** is a special case of the explicit initialization.
  
  * Click **Steady State Initialization** (to use only when the explicit initialization is not available): the beginning of the trajectory is computed from the steady state deduced from the model; the data in **output file** are not used for evaluation, but only as a **reference** for computation of the metrics.
  
  * To provide an explicit initialization:
  
    * Click on the pair input/output, a window for **Time steps for initialization** appears.
      Here, the initialization interval always starts from the beginning of the trajectory. 
      Choose the number of time steps to use for initialization **Time steps for initialization**. The value proposed by default is equal to **init time steps** from the **Default Initialization**
      The interval is taken from **output file** to initialize the evaluation of the prediction (see :std:ref:`Evaluate NeurEco Discrete Dynamic model with GUI`).
	
    * Click on **Compute metrics**
	
    .. figure:: ../../../images/GUIMetricsDynamicInit.png
      :width: 400
      :alt: GUIMetricsDynamicInit
      :align: center

* The results are displayed, and the **Metrics** tab provides also a **Plot reference vs. prediction** for the selected dataset.

An example of a result looks as follows:

.. figure:: ../../../images/GUIMetricsDiscreteDynamic.png
  :width: 700
  :alt: GUIMetricsDiscreteDynamic
  :align: center

  GUI operations: metrics evaluation for **Discrete Dynamic**, test case :std:ref:`Nonlinear oscillator test case`

.. Note::
    
  | By default, the evaluation of metrics is performed with the last model available in the checkpoint.
  | Use the checkpoint slider in the bottom to choose any other available model and get its metrics.